package commands.controller;

/**
 * Request to add new file to downloads
 * @author Marcin Kamionowski
 */
public class CC_GUIAddDownload extends ControllerCommand {

    final private String filename;
    final private String dstPath;
    final private long size;
    final private String hash;

    /**
     * Constructor
     * @param filename Name of file to download
     * @param dstPath Path to direcotry where save it
     * @param size Size of that file
     * @param hash Hash of that file
     */
    public CC_GUIAddDownload(String filename, String dstPath, long size, String hash) {
        super(ControllerCommandType.GUI_ADD_DOWNLOAD);
        this.filename = filename;
        this.dstPath = dstPath;
        this.size = size;
        this.hash = hash;
    }

    /**
     * Getter
     * @return Path to direcotry where save it
     */
    public String getDstPath() {
        return dstPath;
    }

    /**
     * Getter
     * @return Name of file to download
     */
    public String getFilename() {
        return filename;
    }

    /**
     * Getter
     * @return Hash of file to download
     */
    public String getHash() {
        return hash;
    }

    /**
     * Getter
     * @return Size of file to download
     */
    public long getSize() {
        return size;
    }

    @Override
    public String toString() {
        StringBuilder toStringBuilder = new StringBuilder();
        toStringBuilder.append(super.toString());
        toStringBuilder.append("\n");
        toStringBuilder.append("\nfilename: ");
        toStringBuilder.append(filename);
        toStringBuilder.append("\ndstPath: ");
        toStringBuilder.append(dstPath);
        toStringBuilder.append("\nsize: ");
        toStringBuilder.append(size);
        toStringBuilder.append("\nhash: ");
        toStringBuilder.append(hash);
        return toStringBuilder.toString();
    }
}
